﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using JXT.PrimaryKey.Batman.Collections;
using JXT.PrimaryKey.Batman.Core.Language;
using JXT.PrimaryKey.Batman.Core.Extensions;
using JXT.PrimaryKey.Batman.Web.Mvc.Models;
using JXT.PrimaryKey.Batman.Core.Security;
using JXT.PrimaryKey.Batman.Web.Mvc.Filters;
using JXT.PrimaryKey.Batman.Web.Mvc.Extensions;


namespace JXT.PrimaryKey.Batman.Web.Mvc.Controllers
{
    public class ManagerController : BaseController
    {
        [HttpGet]
        [ActionName("managerlogin")]
        public ActionResult ManagerLogin()
        {
            return View();
        }

        [HttpPost]
        [ActionName("managerlogin")]
        public ActionResult ManagerLogin(ViewLoginUser loginUser)
        {
            
            if (string.IsNullOrEmpty(loginUser.ReturnUrl))
                return Message("return url is not null");
            if (Membership.IsLogin)
                return Redirect(loginUser.ReturnUrl);
            var flag = Membership.LoginByName(loginUser.Name, loginUser.Password);
            if (flag)
                return Redirect(loginUser.ReturnUrl);
            return Message("loginname or loginpass is error");
        }

        [HttpGet]
        [ActionName("managermain")]
        public ActionResult ManagerMain()
        {
            return View();
        }
    }
}
